home *** CD-ROM | disk | FTP | other *** search
- /* Projekt csbparse
- softbase
- Copyright ⌐ 1993-1998 by SoftBase
-
- SUBSYSTEM: csbparse.dll 3.7
- FILENAME: astdsbpar.cpp
-
- ABSTRACT
- ========
- Functions for creation and use of sbParser and sbCalculator objects by
- HANDLE (void*) with any C/C++ compiler.
- */
-
- #include <astsbpar.h> //Link necessary header
-
- //------ DLL functions ---------------------------------------------------------
-
- char* ( *DLLGetParserVersionString)(char* strbuffer);
- char* ( *DLLGetParserVersionNumber)(char* strbuffer);
-
- bool ( *DLLInitSTDsbParserDLL2)(char* iv);
- bool ( *DLLDeinitSTDsbParserDLL2)(void);
- int ( *DLLGetInitCount)(void);
- bool ( *IsRegSTDsbParserDLL)(void);
-
- //------ sbParser functions ----------------------------------------------------
-
- //iux == reserved for internal use
- void* ( *DLLCreateNewParser1)(char *FunctionIn, int VarCountIn,
- char *VarDescIn,
- bool iu1 = true, bool iu2 = true, bool iu3 = true, bool iu4 = true);
- void* ( *DLLCreateNewParser2)(char *FunctionIn, int BaseIn = 10,
- bool iu1 = true, bool iu2 = true, bool iu3 = true, bool iu4 = true);
- void* ( *DLLCreateNewParser3)(char *FunctionIn, int BaseIn,
- int VarCountIn, char *VarDescIn,
- bool iu1 = true, bool iu2 = true, bool iu3 = true, bool iu4 = true);
-
- bool ( *DLLDeleteParser)(void* hParser);
-
- bool ( *DLLSetVarCont)(void* hParser, const char *AVarDescIn,
- long double VarContIn);
-
- long double ( *DLLGetResult1)(void* hParser);
- long double ( *DLLGetResult2)(void* hParser, long double VarContIn);
- long double ( *DLLGetResultExt)(void* hParser, long double VarContIn[]);
-
- bool ( *DLLIsParserFunction)(const char *FuncStrIn);
-
- //use these functions if your compiler doesn't support long double (80bit)
- bool ( *DLLdSetVarCont)(void* hParser, const char *AVarDescIn,
- double VarContIn);
-
- double ( *DLLdGetResult1)(void* hParser);
- double ( *DLLdGetResult2)(void* hParser, double VarContIn);
- double ( *DLLdGetResultExt)(void* hParser, double VarContIn[]);
- //+++
-
- const char* ( *DLLGetOriginFunc)(void* hParser, char *strbuffer);
- long ( *DLLGetOriginFuncLen)(void* hParser);
- int ( *DLLGetOriginVarCount)(void* hParser);
- bool ( *DLLGetIsOriginFunc)(void* hParser, char *FunctionIn);
-
- bool ( *DLLGetIsError)(void* hParser);
- int ( *DLLGetGlobalError)(void* hParser);
- char* ( *DLLGetUnknownFunction)(void* hParser, char *strbuffer);
-
- bool ( *DLLSetBaseTo)(void* hParser, int BaseIn);
- bool ( *DLLSetAngularUnitTo)(void* hParser, int AngularUnitIn);
- bool ( *DLLSetNewFunction)(void* hParser, char *FunctionIn);
-
- int ( *DLLGetBase)(void* hParser);
- int ( *DLLGetAngularUnit)(void* hParser);
-
- //------ useful functions -----------------------------------------------------
-
- bool ( *DLLConvertToBase)(char *strbuffer, const long double value,
- int b_point, int BaseIn);
- long double ( *DLLConvertBaseTold1)(const char *strValue, int BaseIn,
- char **endptr = NULL);
- long double ( *DLLConvertBaseTold2)(const char *strValue, int BaseIn,
- int* errPos);
-
- unsigned int( *DLLSetFPError)(bool Enable = FALSE);
-
- char* ( *DLLldtochar)(char *strbuffer, const long double value,
- int point = 0, bool Validate = true);
- long double ( *DLLchartold1)(const char *strValue, char **endptr = NULL,
- bool Validate = true);
- long double ( *DLLchartold2)(const char *strValue, int* errPos,
- bool Validate = true);
-
- long double ( *DLLcorrroundl1)(long double value);
- long double ( *DLLcorrroundl2)(long double value, int point);
-
- char* ( *DLLturnintochar)(char *strbuffer, const char *SubFuncIn,
- const char *searchIn,
- const char *turnIn, bool singleVar);
- char* ( *DLLGetLastValue)(char* strbuffer,const char* SearchString,
- int CurrPos,int *StartPos,bool withOper = false);
-
- //use these functions if your compiler doesn't support long double (80bit)
- bool ( *DLLdConvertToBase)(char *strbuffer, const double value,
- int b_point, int BaseIn);
- double ( *DLLConvertBaseTod1)(const char *strValue, int BaseIn,
- char **endptr = NULL);
- double ( *DLLConvertBaseTod2)(const char *strValue, int BaseIn,
- int* errPos);
-
- char* ( *DLLdtochar)(char *strbuffer, const double value,
- int point = 0, bool Validate = true);
- double ( *DLLchartod1)(const char *strValue, char **endptr = NULL,
- bool Validate = true);
- double ( *DLLchartod2)(const char *strValue, int* errPos,
- bool Validate = true);
-
- double ( *DLLcorrround)(double value, int point);
- //+++
-
- //------ Debug and Information -------------------------------------------------
-
- bool ( *DLLGetDebugsbDLL)(void);
- bool ( *DLLSetDebugsbDLL)(bool debugIn);
-
- bool ( *DLLGetVarStruct)(void* hParser, void* VarStructIn);
- bool ( *DLLGetOpStructPos)(void* hParser, int pos, char *buffFunction,
- int* val1, int* val2, int* valResult);
- bool ( *DLLGetInvValuesPos)(void* hParser, int pos, long double *val);
-
- //use these functions if your compiler doesn't support long double (80bit)
- bool ( *DLLdGetVarStruct)(void* hParser, void* VarStructIn);
- bool ( *DLLdGetInvValuesPos)(void* hParser, int pos, double *val);
- //+++
-
- //------ sbCalculator functions ------------------------------------------------
-
- void* ( *DLLCreateNewCalculator)(char *InitStr, bool fastIn = true,
- int VarCountIn = 0, char* VarDescIn = "");
-
- bool ( *DLLDeleteCalculator)(void* hCalculator);
-
- int ( *DLLGetVarCount)(void* hCalculator);
- char* ( *DLLGetFunction)(void* hCalculator, char *strbuffer);
-
- //iux == reserved for internal use
- bool ( *DLLMake)(void* hCalculator, char *Input, bool iu1 = false);
-
- char* ( *DLLGetShowFunc)(void* hCalculator, char *strbuffer, int point = 0,
- long double VarContIn[] = 0, bool ext = false,
- char* secondShow = 0);
- long double ( *DLLGetLastResult)(void* hCalculator);
-
- //use these functions if your compiler doesn't support long double (80bit)
- char* ( *DLLdGetShowFunc)(void* hCalculator, char *strbuffer, int point = 0,
- double VarContIn[] = 0, bool ext = false,
- char* secondShow = 0);
- double ( *DLLdGetLastResult)(void* hCalculator);
- //+++
-
- char* ( *DLLGetInfo)(void* hCalculator, char *strbuffer);
-
- void ( *DLLSetFast)(void* hCalculator, bool fastIn = true);
- bool ( *DLLGetFast)(void* hCalculator);
-
- void ( *DLLSetFatalErr)(void* hCalculator, bool FatalErrIn=true);
- bool ( *DLLGetFatalErr)(void* hCalculator);
-
- bool ( *DLLSetAngularUnitInOutTo)(void* hCalculator, int AngularUnitIn);
- int ( *DLLGetAngularUnitInOut)(void* hCalculator);
- bool ( *DLLSetBaseInTo)(void* hCalculator, int BaseIn);
- int ( *DLLGetBaseIn)(void* hCalculator);
- bool ( *DLLSetBaseOutTo)(void* hCalculator, int BaseIn);
- int ( *DLLGetBaseOut)(void* hCalculator);
-
- //------ DLL functions ---------------------------------------------------------
-
- const char stdsbparDLL[] = "CSBPARSE.DLL";
- HINSTANCE hSTDsbParserDLL = 0;
- bool mainDLLerr = false;
-
- bool InitSTDsbParserDLL(char* iv) {
- mainDLLerr = false;
-
- hSTDsbParserDLL = LoadLibrary(stdsbparDLL);
- if((unsigned)hSTDsbParserDLL<=HINSTANCE_ERROR) {
- MessageBox(NULL, "CSBPARSE.DLL not found", "Library Error", MB_OK | MB_ICONERROR);
- mainDLLerr = true;
- return FALSE;
- }
-
- DLLGetParserVersionString = (char*( *)(char*)) GetProcAddress(hSTDsbParserDLL, "@GetParserVersionString$qpc");
- DLLGetParserVersionNumber = (char*( *)(char*)) GetProcAddress(hSTDsbParserDLL, "@GetParserVersionNumber$qpc");
-
- DLLInitSTDsbParserDLL2 = (bool( *)(char*)) GetProcAddress(hSTDsbParserDLL, "@InitSTDsbParserDLL$qpc");
- DLLDeinitSTDsbParserDLL2 = (bool( *)(void)) GetProcAddress(hSTDsbParserDLL, "@DeinitSTDsbParserDLL$qv");
- DLLGetInitCount = (int( *)(void)) GetProcAddress(hSTDsbParserDLL, "@GetInitCount$qv");
- IsRegSTDsbParserDLL = (bool( *)(void)) GetProcAddress(hSTDsbParserDLL, "@IsRegSTDsbParserDLL$qv");
-
- DLLCreateNewParser1 = (void*( *)(char *, int,
- char *,
- bool, bool, bool, bool)) GetProcAddress(hSTDsbParserDLL, "@CreateNewParser$qpcit14boolt4t4t4");
- DLLCreateNewParser2 = (void*( *)(char *, int,
- bool, bool, bool, bool)) GetProcAddress(hSTDsbParserDLL, "@CreateNewParser$qpci4boolt3t3t3");
- DLLCreateNewParser3 = (void*( *)(char *, int,
- int, char *,
- bool, bool, bool, bool iu4)) GetProcAddress(hSTDsbParserDLL, "@CreateNewParser$qpciit14boolt5t5t5");
-
- DLLDeleteParser = (bool( *)(void*)) GetProcAddress(hSTDsbParserDLL, "@DeleteParser$qpv");
-
- DLLSetVarCont = (bool( *)(void*, const char *,
- long double)) GetProcAddress(hSTDsbParserDLL, "@SetVarCont$qpvpxcg");
-
- DLLGetResult1 = (long double( *)(void*)) GetProcAddress(hSTDsbParserDLL, "@GetResult$qpv");
- DLLGetResult2 = (long double( *)(void*, long double)) GetProcAddress(hSTDsbParserDLL, "@GetResult$qpvg");
- DLLGetResultExt = (long double( *)(void*, long double*)) GetProcAddress(hSTDsbParserDLL, "@GetResultExt$qpvpg");
-
- DLLIsParserFunction = (bool( *)(const char*)) GetProcAddress(hSTDsbParserDLL, "@IsParserFunction$qpxc");
-
- DLLdSetVarCont = (bool( *)(void*, const char *,
- double)) GetProcAddress(hSTDsbParserDLL, "@dSetVarCont$qpvpxcd");
-
- DLLdGetResult1 = (double( *)(void*)) GetProcAddress(hSTDsbParserDLL, "@dGetResult$qpv");
- DLLdGetResult2 = (double( *)(void*, double)) GetProcAddress(hSTDsbParserDLL, "@dGetResult$qpvd");
- DLLdGetResultExt = (double( *)(void*, double*)) GetProcAddress(hSTDsbParserDLL, "@dGetResultExt$qpvpd");
-
- DLLGetOriginFunc = (const char*( *)(void*, char *)) GetProcAddress(hSTDsbParserDLL, "@GetOriginFunc$qpvpc");
- DLLGetOriginFuncLen = (long( *)(void*)) GetProcAddress(hSTDsbParserDLL, "@GetOriginFuncLen$qpv");
- DLLGetOriginVarCount = (int( *)(void*)) GetProcAddress(hSTDsbParserDLL, "@GetOriginVarCount$qpv");
- DLLGetIsOriginFunc = (bool( *)(void*, char *)) GetProcAddress(hSTDsbParserDLL, "@GetIsOriginFunc$qpvpc");
-
- DLLGetIsError = (bool( *)(void*)) GetProcAddress(hSTDsbParserDLL, "@GetIsError$qpv");
- DLLGetGlobalError = (int( *)(void*)) GetProcAddress(hSTDsbParserDLL, "@GetGlobalError$qpv");
- DLLGetUnknownFunction = (char*( *)(void*, char *)) GetProcAddress(hSTDsbParserDLL, "@GetUnknownFunction$qpvpc");
-
- DLLSetBaseTo = (bool( *)(void*, int)) GetProcAddress(hSTDsbParserDLL, "@SetBaseTo$qpvi");
- DLLSetAngularUnitTo = (bool( *)(void*, int)) GetProcAddress(hSTDsbParserDLL, "@SetAngularUnitTo$qpvi");
- DLLSetNewFunction = (bool( *)(void*, char *)) GetProcAddress(hSTDsbParserDLL, "@SetNewFunction$qpvpc");
-
- DLLGetBase = (int( *)(void*)) GetProcAddress(hSTDsbParserDLL, "@GetBase$qpv");
- DLLGetAngularUnit = (int( *)(void*)) GetProcAddress(hSTDsbParserDLL, "@GetAngularUnit$qpv");
-
- DLLConvertToBase = (bool( *)(char *, const long double,
- int, int)) GetProcAddress(hSTDsbParserDLL, "@ConvertToBase$qpcxgii");
- DLLConvertBaseTold1 = (long double( *)(const char *, int,
- char **)) GetProcAddress(hSTDsbParserDLL, "@ConvertBaseTold$qpxcippc");
- DLLConvertBaseTold2 = (long double( *)(const char *, int,
- int*)) GetProcAddress(hSTDsbParserDLL, "@ConvertBaseTold$qpxcipi");
-
- DLLSetFPError = (unsigned int( *)(bool)) GetProcAddress(hSTDsbParserDLL, "@SetFPError$q4bool");
-
- DLLldtochar = (char*( *)(char *, const long double,
- int, bool)) GetProcAddress(hSTDsbParserDLL, "@ldtochar$qpcxgi4bool");
- DLLchartold1 = (long double( *)(const char *, char **,
- bool)) GetProcAddress(hSTDsbParserDLL, "@chartold$qpxcppc4bool");
- DLLchartold2 = (long double( *)(const char *, int*,
- bool)) GetProcAddress(hSTDsbParserDLL, "@chartold$qpxcpi4bool");
-
- DLLcorrroundl1 = (long double( *)(long double)) GetProcAddress(hSTDsbParserDLL, "@corrroundl$qg");
- DLLcorrroundl2 = (long double( *)(long double, int)) GetProcAddress(hSTDsbParserDLL, "@corrroundl$qgi");
-
- DLLturnintochar = (char *( *)(char*, const char *, const char *, const char *,
- bool)) GetProcAddress(hSTDsbParserDLL, "@turnintochar$qpcpxct2t24bool");
- DLLGetLastValue = (char *( *)(char*, const char*, int, int*, bool)) GetProcAddress(hSTDsbParserDLL, "@GetLastValue$qpcpxcipi4bool");
-
- DLLdConvertToBase = (bool( *)(char *, const double,
- int, int)) GetProcAddress(hSTDsbParserDLL, "@dConvertToBase$qpcxdii");
- DLLConvertBaseTod1 = (double( *)(const char *, int,
- char **)) GetProcAddress(hSTDsbParserDLL, "@ConvertBaseTod$qpxcippc");
- DLLConvertBaseTod2 = (double( *)(const char *, int,
- int*)) GetProcAddress(hSTDsbParserDLL, "@ConvertBaseTod$qpxcipi");
-
- DLLdtochar = (char*( *)(char *, const double,
- int, bool)) GetProcAddress(hSTDsbParserDLL, "@dtochar$qpcxdi4bool");
- DLLchartod1 = (double( *)(const char *, char **,
- bool)) GetProcAddress(hSTDsbParserDLL, "@chartold$qpxcppc4bool");
- DLLchartod2 = (double( *)(const char *, int*,
- bool)) GetProcAddress(hSTDsbParserDLL, "@chartold$qpxcpi4bool");
-
- DLLcorrround = (double( *)(double, int)) GetProcAddress(hSTDsbParserDLL, "@corrround$qdi");
-
- //------ Debug and Information ----------------------------------------------
-
- DLLGetDebugsbDLL = (bool( *)(void))GetProcAddress(hSTDsbParserDLL, "@GetDebugsbDLL$qv");
- DLLSetDebugsbDLL = (bool( *)(bool))GetProcAddress(hSTDsbParserDLL, "@SetDebugsbDLL$q4bool");
-
- DLLGetVarStruct = (bool( *)(void*, void*))GetProcAddress(hSTDsbParserDLL, "@GetVarStruct$qpvt1");
- DLLGetOpStructPos = (bool( *)(void*, int, char *,
- int*, int*, int* )) GetProcAddress(hSTDsbParserDLL, "@GetOpStructPos$qpvipcpit4t4");
- DLLGetInvValuesPos = (bool( *)(void*, int, long double *)) GetProcAddress(hSTDsbParserDLL, "@GetInvValuesPos$qpvipg");
-
- //use these functions if your compiler doesn't support long double (80bit)
- DLLdGetVarStruct = (bool( *)(void*, void*))GetProcAddress(hSTDsbParserDLL, "@dGetVarStruct$qpvt1");
- DLLdGetInvValuesPos = (bool( *)(void*, int, double *)) GetProcAddress(hSTDsbParserDLL, "@dGetInvValuesPos$qpvipd");
-
- //------ sbCalculator functions ---------------------------------------------
-
- DLLCreateNewCalculator = (void*( *)(char*, bool, int, char*))GetProcAddress(hSTDsbParserDLL, "@CreateNewCalculator$qpc4boolit1");
-
- DLLDeleteCalculator = (bool( *)(void*))GetProcAddress(hSTDsbParserDLL, "@DeleteCalculator$qpv");
-
- DLLGetVarCount = (int( *)(void*))GetProcAddress(hSTDsbParserDLL, "@GetVarCount$qpv");
- DLLGetFunction = (char*( *)(void*, char*))GetProcAddress(hSTDsbParserDLL, "@GetFunction$qpvpc");
-
- DLLMake = (bool( *)(void*, char*, bool))GetProcAddress(hSTDsbParserDLL, "@Make$qpvpc4bool");
-
- DLLGetShowFunc = (char*( *)(void*, char*, int, long double*, bool, char*))GetProcAddress(hSTDsbParserDLL, "@GetShowFunc$qpvpcipg4boolt2");
- DLLGetLastResult = (long double( *)(void*))GetProcAddress(hSTDsbParserDLL, "@GetLastResult$qpv");
-
- //use these functions if your compiler doesn't support long double (80bit)
- DLLdGetShowFunc = (char*( *)(void*, char*, int, double*, bool, char*))GetProcAddress(hSTDsbParserDLL, "@dGetShowFunc$qpvpcipd4boolt2");
- DLLdGetLastResult = (double( *)(void*))GetProcAddress(hSTDsbParserDLL, "@dGetLastResult$qpv");
-
- DLLGetInfo = (char*( *)(void*, char*))GetProcAddress(hSTDsbParserDLL, "@GetInfo$qpvpc");
-
- DLLSetFast = (void( *)(void*, bool))GetProcAddress(hSTDsbParserDLL, "@SetFast$qpv4bool");
- DLLGetFast = (bool( *)(void*))GetProcAddress(hSTDsbParserDLL, "@GetFast$qpv");
-
- DLLSetFatalErr = (void( *)(void*, bool))GetProcAddress(hSTDsbParserDLL, "@SetFatalErr$qpv4bool");
- DLLGetFatalErr = (bool( *)(void*))GetProcAddress(hSTDsbParserDLL, "@GetFatalErr$qpv");
-
- DLLSetAngularUnitInOutTo = (bool( *)(void*, int))GetProcAddress(hSTDsbParserDLL, "@SetAngularUnitInOutTo$qpvi");
- DLLGetAngularUnitInOut = (int( *)(void*))GetProcAddress(hSTDsbParserDLL, "@GetAngularUnitInOut$qpv");
- DLLSetBaseInTo = (bool( *)(void*, int))GetProcAddress(hSTDsbParserDLL, "@SetBaseInTo$qpvi");
- DLLGetBaseIn = (int( *)(void*))GetProcAddress(hSTDsbParserDLL, "@GetBaseIn$qpv");
- DLLSetBaseOutTo = (bool( *)(void*, int))GetProcAddress(hSTDsbParserDLL, "@SetBaseOutTo$qpvi");
- DLLGetBaseOut = (int( *)(void*))GetProcAddress(hSTDsbParserDLL, "@GetBaseOut$qpv");
-
- if ((DLLGetParserVersionString == NULL)
- ||(DLLGetParserVersionNumber == NULL)
- ||(DLLInitSTDsbParserDLL2 == NULL)
- ||(DLLDeinitSTDsbParserDLL2 == NULL)
- ||(DLLGetInitCount == NULL)
- ||(IsRegSTDsbParserDLL == NULL)
- ||(DLLCreateNewParser1 == NULL)
- ||(DLLCreateNewParser2 == NULL)
- ||(DLLCreateNewParser3 == NULL)
- ||(DLLDeleteParser == NULL)
- ||(DLLSetVarCont == NULL)
- ||(DLLGetResult1 == NULL)
- ||(DLLGetResult2 == NULL)
- ||(DLLGetResultExt == NULL)
- ||(DLLdSetVarCont == NULL)
- ||(DLLdGetResult1 == NULL)
- ||(DLLdGetResult2 == NULL)
- ||(DLLdGetResultExt == NULL)
- ||(DLLGetOriginFunc == NULL)
- ||(DLLGetOriginFuncLen == NULL)
- ||(DLLGetOriginVarCount == NULL)
- ||(DLLGetIsOriginFunc == NULL)
- ||(DLLGetIsError == NULL)
- ||(DLLGetGlobalError == NULL)
- ||(DLLGetUnknownFunction == NULL)
- ||(DLLSetBaseTo == NULL)
- ||(DLLSetAngularUnitTo == NULL)
- ||(DLLSetNewFunction == NULL)
- ||(DLLGetBase == NULL)
- ||(DLLGetAngularUnit == NULL)
- ||(DLLConvertToBase == NULL)
- ||(DLLConvertBaseTold1 == NULL)
- ||(DLLConvertBaseTold2 == NULL)
- ||(DLLSetFPError == NULL)
- ||(DLLldtochar == NULL)
- ||(DLLchartold1 == NULL)
- ||(DLLchartold2 == NULL)
- ||(DLLturnintochar == NULL)
- ||(DLLdConvertToBase == NULL)
- ||(DLLConvertBaseTod1 == NULL)
- ||(DLLConvertBaseTod2 == NULL)
- ||(DLLdtochar == NULL)
- ||(DLLchartod1 == NULL)
- ||(DLLchartod2 == NULL)
- ||(DLLcorrround == NULL)
-
- //Debug and Information
- ||(DLLGetDebugsbDLL == NULL)
- ||(DLLSetDebugsbDLL == NULL)
- ||(DLLGetVarStruct == NULL)
- ||(DLLGetOpStructPos == NULL)
- ||(DLLGetInvValuesPos == NULL)
- //use these functions if your compiler doesn't support long double (80bit)
- ||(DLLdGetVarStruct == NULL)
- ||(DLLdGetInvValuesPos == NULL)
- //+++
-
- //------ sbCalculator functions ------------------------------------------
- ||(DLLCreateNewCalculator == NULL)
- ||(DLLDeleteCalculator == NULL)
- ||(DLLGetVarCount == NULL)
- ||(DLLGetFunction == NULL)
- ||(DLLMake == NULL)
- ||(DLLGetShowFunc == NULL)
- ||(DLLGetLastResult == NULL)
- //use these functions if your compiler doesn't support long double (80bit)
- ||(DLLdGetShowFunc == NULL)
- ||(DLLdGetLastResult == NULL)
- //+++
- ||(DLLGetInfo == NULL)
- ||(DLLSetFast == NULL)
- ||(DLLGetFast == NULL)
- ||(DLLSetFatalErr == NULL)
- ||(DLLGetFatalErr == NULL)
- ||(DLLSetAngularUnitInOutTo == NULL)
- ||(DLLGetAngularUnitInOut == NULL)
- ||(DLLSetBaseInTo == NULL)
- ||(DLLGetBaseIn == NULL)
- ||(DLLSetBaseOutTo == NULL)
- ||(DLLGetBaseOut == NULL)
- ) {
-
- char temp[500];
- char temp2[150];
-
- strcpy(temp,
- "The loaded CSBPARSE.DLL isn't the correct one. Maybe the version differs. The loaded CSBPARSE.DLL has the version number ");
- if (DLLGetParserVersionNumber == NULL) {
- strcat(temp, "(no version available)");
- }
- else {
- strcat(temp, DLLGetParserVersionNumber(temp2));
- }
- strcat(temp, ".");
-
- MessageBox(NULL, temp, "Library Error", MB_OK | MB_ICONERROR);
- FreeLibrary(hSTDsbParserDLL);
- hSTDsbParserDLL = 0;
- return FALSE;
- }
-
- return DLLInitSTDsbParserDLL2(iv);
- }
-
- void InitMessageOut() {
- if (mainDLLerr == false) {
- MessageBox(NULL, "Call InitSTDsbParserDLL() first...", "Library Error", MB_OK | MB_ICONERROR);
- }
- }
-
- int GetInitCount() {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetInitCount();
- }
- else {
- //InitMessageOut();
- return 0;
- }
- }
-
- bool IsRegSTDsbParser() {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return IsRegSTDsbParserDLL();
- }
- else {
- //InitMessageOut();
- return false;
- }
- }
-
- bool DeinitSTDsbParserDLL() {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- bool retVal = DLLDeinitSTDsbParserDLL2();
- if (GetInitCount() == 0) {
- FreeLibrary(hSTDsbParserDLL);
- hSTDsbParserDLL = 0;
- }
- return retVal;
- }
- else {
- InitMessageOut();
- return false;
- }
- }
-
- //------ sbParser functions ----------------------------------------------------
-
- char* GetParserVersionString(char *strbuffer) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetParserVersionString(strbuffer);
- }
- else {
- InitMessageOut();
- return strcpy(strbuffer, "");
- }
- }
- char* GetParserVersionNumber(char *strbuffer) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetParserVersionNumber(strbuffer);
- }
- else {
- InitMessageOut();
- return strcpy(strbuffer, "");
- }
- }
-
- //iux == reserved for internal use
- HANDLE CreateNewParser(char *FunctionIn, int VarCountIn,
- char *VarDescIn,
- bool iu1, bool iu2, bool iu3, bool iu4) {
-
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLCreateNewParser1(FunctionIn, VarCountIn,
- VarDescIn,
- iu1, iu2, iu3, iu4);
- }
- else {
- InitMessageOut();
- return NULL;
- }
- }
- HANDLE CreateNewParser(char *FunctionIn, int BaseIn,
- bool iu1, bool iu2, bool iu3, bool iu4) {
-
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLCreateNewParser2(FunctionIn, BaseIn,
- iu1, iu2, iu3, iu4);
- }
- else {
- InitMessageOut();
- return NULL;
- }
- }
- HANDLE CreateNewParser(char *FunctionIn, int BaseIn,
- int VarCountIn, char *VarDescIn,
- bool iu1, bool iu2, bool iu3, bool iu4) {
-
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLCreateNewParser3(FunctionIn, BaseIn,
- VarCountIn, VarDescIn,
- iu1, iu2, iu3, iu4);
- }
- else {
- InitMessageOut();
- return NULL;
- }
- }
-
- bool DeleteParser(HANDLE hParser) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLDeleteParser(hParser);
- }
- else {
- return false;
- }
- }
-
- bool SetVarCont(HANDLE hParser, const char *AVarDescIn,
- long double VarContIn) {
-
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLSetVarCont(hParser, AVarDescIn,
- VarContIn);
- }
- else {
- return false;
- }
- }
-
- long double GetResult(HANDLE hParser) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetResult1(hParser);
- }
- else {
- return 0;
- }
- }
- long double GetResult(HANDLE hParser, long double VarContIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetResult2(hParser, VarContIn);
- }
- else {
- return 0;
- }
- }
- long double GetResultExt(HANDLE hParser, long double VarContIn[]) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetResultExt(hParser, VarContIn);
- }
- else {
- return 0;
- }
- }
-
- bool IsParserFunction(const char *FuncStrIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLIsParserFunction(FuncStrIn);
- }
- else {
- return 0;
- }
- }
-
- //use these functions if your compiler doesn't support long double (80bit)
- bool dSetVarCont(HANDLE hParser, const char *AVarDescIn,
- double VarContIn) {
-
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLdSetVarCont(hParser, AVarDescIn,
- VarContIn);
- }
- else {
- return false;
- }
- }
-
- double dGetResult(HANDLE hParser) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLdGetResult1(hParser);
- }
- else {
- return 0;
- }
- }
- double dGetResult(HANDLE hParser, double VarContIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLdGetResult2(hParser, VarContIn);
- }
- else {
- return 0;
- }
- }
- double dGetResultExt(HANDLE hParser, double VarContIn[]) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLdGetResultExt(hParser, VarContIn);
- }
- else {
- return 0;
- }
- }
- //+++
-
- const char* GetOriginFunc(HANDLE hParser, char *strbuffer) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetOriginFunc(hParser, strbuffer);
- }
- else {
- return strcpy(strbuffer, "");
- }
- }
- long GetOriginFuncLen(HANDLE hParser) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetOriginFuncLen(hParser);
- }
- else {
- return 0;
- }
- }
- int GetOriginVarCount(HANDLE hParser) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetOriginVarCount(hParser);
- }
- else {
- return 0;
- }
- }
- bool GetIsOriginFunc(HANDLE hParser, char *FunctionIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetIsOriginFunc(hParser, FunctionIn);
- }
- else {
- return false;
- }
- }
-
- bool GetIsError(HANDLE hParser) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetIsError(hParser);
- }
- else {
- return false;
- }
- }
- int GetGlobalError(HANDLE hParser) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetGlobalError(hParser);
- }
- else {
- return 0;
- }
- }
- char* GetUnknownFunction(HANDLE hParser, char *strbuffer) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetUnknownFunction(hParser, strbuffer);
- }
- else {
- return strcpy(strbuffer, "");
- }
- }
-
- bool SetBaseTo(HANDLE hParser, int BaseIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLSetBaseTo(hParser, BaseIn);
- }
- else {
- return false;
- }
- }
- bool SetAngularUnitTo(HANDLE hParser, int AngularUnitIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLSetAngularUnitTo(hParser, AngularUnitIn);
- }
- else {
- return false;
- }
- }
- bool SetNewFunction(HANDLE hParser, char *FunctionIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLSetNewFunction(hParser, FunctionIn);
- }
- else {
- return false;
- }
- }
-
- int GetBase(HANDLE hParser) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetBase(hParser);
- }
- else {
- return 0;
- }
- }
- int GetAngularUnit(HANDLE hParser) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetAngularUnit(hParser);
- }
- else {
- return 0;
- }
- }
-
- //------ useful functions -----------------------------------------------------
-
- bool ConvertToBase(char *strbuffer, const long double value,
- int b_point, int BaseIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLConvertToBase(strbuffer, value,
- b_point, BaseIn);
- }
- else {
- return false;
- }
- }
- long double ConvertBaseTold(const char *strValue, int BaseIn,
- char **endptr) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLConvertBaseTold1(strValue, BaseIn,
- endptr);
- }
- else {
- return 0;
- }
- }
- long double ConvertBaseTold(const char *strValue, int BaseIn,
- int* errPos) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLConvertBaseTold2(strValue, BaseIn,
- errPos);
- }
- else {
- return 0;
- }
- }
-
- unsigned int SetFPError(bool Enable) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLSetFPError(Enable);
- }
- else {
- return 0;
- }
- }
-
- char* ldtochar(char *strbuffer, const long double value,
- int point, bool Validate) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLldtochar(strbuffer, value,
- point, Validate);
- }
- else {
- return strcpy(strbuffer, "");;
- }
- }
- long double chartold(const char *strValue, char **endptr,
- bool Validate) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLchartold1(strValue, endptr,
- Validate);
- }
- else {
- return 0;
- }
- }
- long double chartold(const char *strValue, int* errPos,
- bool Validate) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLchartold2(strValue, errPos,
- Validate);
- }
- else {
- return 0;
- }
- }
-
- long double corrroundl(long double value) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLcorrroundl1(value);
- }
- else {
- return 0;
- }
- }
- long double corrroundl(long double value, int point) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLcorrroundl2(value, point);
- }
- else {
- return 0;
- }
- }
-
- char* turnintochar(char *strbuffer,const char *SubFuncIn,const char *searchIn,
- const char *turnIn,bool singleVar) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLturnintochar(strbuffer, SubFuncIn, searchIn,
- turnIn,singleVar);
- }
- else {
- return 0;
- }
- }
- char* GetLastValue(char* strbuffer, const char* SearchString,
- int CurrPos, int *StartPos, bool withOper) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetLastValue(strbuffer, SearchString,
- CurrPos, StartPos, withOper);
- }
- else {
- return 0;
- }
- }
-
- //use these functions if your compiler doesn't support long double (80bit)
- bool dConvertToBase(char *strbuffer, const double value,
- int b_point, int BaseIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLdConvertToBase(strbuffer, value,
- b_point, BaseIn);
- }
- else {
- return false;
- }
- }
- double ConvertBaseTod(const char *strValue, int BaseIn,
- char **endptr) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLConvertBaseTod1(strValue, BaseIn,
- endptr);
- }
- else {
- return 0;
- }
- }
- double ConvertBaseTod(const char *strValue, int BaseIn,
- int* errPos) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLConvertBaseTod2(strValue, BaseIn,
- errPos);
- }
- else {
- return 0;
- }
- }
-
- char* dtochar(char *strbuffer, const double value,
- int point, bool Validate) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLdtochar(strbuffer, value,
- point, Validate);
- }
- else {
- return strcpy(strbuffer, "");
- }
- }
- double chartod(const char *strValue, char **endptr,
- bool Validate) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLchartod1(strValue, endptr,
- Validate);
- }
- else {
- return 0;
- }
- }
- double chartod(const char *strValue, int* errPos,
- bool Validate) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLchartod2(strValue, errPos,
- Validate);
- }
- else {
- return 0;
- }
- }
-
- double corrround(double value, int point) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLcorrround(value, point);
- }
- else {
- return 0;
- }
- }
- //+++
-
- //------ Debug and Information -------------------------------------------------
-
- bool GetDebugsbDLL() {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetDebugsbDLL();
- }
- else {
- return 0;
- }
- }
- bool SetDebugsbDLL(bool debugIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLSetDebugsbDLL(debugIn);
- }
- else {
- return 0;
- }
- }
-
- bool GetVarStruct(HANDLE hParser, HANDLE VarStructIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetVarStruct(hParser, VarStructIn);
- }
- else {
- return 0;
- }
- }
- bool GetOpStructPos(HANDLE hParser, int pos, char *buffFunction,
- int* val1, int* val2, int* valResult) {
- if(((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR)
- && (DLLGetOpStructPos!=NULL)) {
- return DLLGetOpStructPos(hParser, pos, buffFunction,
- val1, val2, valResult);
- }
- else {
- return 0;
- }
- }
- bool GetInvValuesPos(HANDLE hParser, int pos, long double *val) {
- if(((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR)
- && (DLLGetInvValuesPos!=NULL)) {
- return DLLGetInvValuesPos(hParser, pos, val);
- }
- else {
- return 0;
- }
- }
-
- //use these functions if your compiler doesn't support long double (80bit)
- bool dGetVarStruct(HANDLE hParser, HANDLE VarStructIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLdGetVarStruct(hParser, VarStructIn);
- }
- else {
- return 0;
- }
- }
- bool dGetInvValuesPos(HANDLE hParser, int pos, double *val) {
- if(((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR)
- && (DLLdGetInvValuesPos!=NULL)) {
- return DLLdGetInvValuesPos(hParser, pos, val);
- }
- else {
- return 0;
- }
- }
- //+++
-
- //------ sbCalculator functions ------------------------------------------------
-
- HANDLE CreateNewCalculator(char *InitStr, bool fastIn,
- int VarCountIn, char* VarDescIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLCreateNewCalculator(InitStr, fastIn,
- VarCountIn, VarDescIn);
- }
- else {
- return 0;
- }
- }
-
- bool DeleteCalculator(HANDLE hCalculator) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLDeleteCalculator(hCalculator);
- }
- else {
- return 0;
- }
- }
-
- int GetVarCount(HANDLE hCalculator) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetVarCount(hCalculator);
- }
- else {
- return 0;
- }
- }
- char *GetFunction(HANDLE hCalculator, char *strbuffer) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetFunction(hCalculator, strbuffer);
- }
- else {
- return 0;
- }
- }
-
- bool Make(HANDLE hCalculator, char *Input, bool iu1) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLMake(hCalculator, Input, iu1);
- }
- else {
- return 0;
- }
- }
-
- char *GetShowFunc(HANDLE hCalculator, char *strbuffer,int point,
- long double VarContIn[], bool ext, char* secondShow) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetShowFunc(hCalculator, strbuffer, point,
- VarContIn, ext, secondShow);
- }
- else {
- return 0;
- }
- }
- long double GetLastResult(HANDLE hCalculator) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetLastResult(hCalculator);
- }
- else {
- return 0;
- }
- }
-
- //use these functions if your compiler doesn't support long double (80bit)
- char *dGetShowFunc(HANDLE hCalculator, char *strbuffer,int point,
- double VarContIn[], bool ext, char* secondShow) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLdGetShowFunc(hCalculator, strbuffer, point,
- VarContIn, ext, secondShow);
- }
- else {
- return 0;
- }
- }
- double dGetLastResult(HANDLE hCalculator) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLdGetLastResult(hCalculator);
- }
- else {
- return 0;
- }
- }
- //+++
-
- char *GetInfo(HANDLE hCalculator, char *strbuffer) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetInfo(hCalculator, strbuffer);
- }
- else {
- return 0;
- }
- }
-
- void SetFast(HANDLE hCalculator, bool fastIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- DLLSetFast(hCalculator, fastIn);
- }
- else {
- return ;
- }
- }
- bool GetFast(HANDLE hCalculator) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetFast(hCalculator);
- }
- else {
- return 0;
- }
- }
-
- void SetFatalErr(HANDLE hCalculator, bool fastIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- DLLSetFatalErr(hCalculator, fastIn);
- }
- else {
- return ;
- }
- }
- bool GetFatalErr(HANDLE hCalculator) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetFatalErr(hCalculator);
- }
- else {
- return 0;
- }
- }
-
- bool SetAngularUnitInOutTo(HANDLE hCalculator, int AngularUnitIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLSetAngularUnitInOutTo(hCalculator, AngularUnitIn);
- }
- else {
- return 0;
- }
- }
- int GetAngularUnitInOut(HANDLE hCalculator) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetAngularUnitInOut(hCalculator);
- }
- else {
- return 0;
- }
- }
- bool SetBaseInTo(HANDLE hCalculator, int BaseIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLSetBaseInTo(hCalculator, BaseIn);
- }
- else {
- return 0;
- }
- }
- int GetBaseIn(HANDLE hCalculator) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetBaseIn(hCalculator);
- }
- else {
- return 0;
- }
- }
- bool SetBaseOutTo(HANDLE hCalculator, int BaseIn) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLSetBaseOutTo(hCalculator, BaseIn);
- }
- else {
- return 0;
- }
- }
- int GetBaseOut(HANDLE hCalculator) {
- if((unsigned)hSTDsbParserDLL>HINSTANCE_ERROR) {
- return DLLGetBaseOut(hCalculator);
- }
- else {
- return 0;
- }
- }
-